package gui;

import interfaces.Command;

import java.awt.event.ActionListener;

import javax.swing.JButton;

import org.apache.log4j.Logger;

import mediator.Mediator;

public class LogoutBtn extends JButton implements Command {

	Mediator med;
	
	public static Logger logger = Logger.getLogger(LogoutBtn.class);
	
	public LogoutBtn (ActionListener act, Mediator md) {
		super("Logout");
		addActionListener(act);
		med = md;
		med.registerLogoutBtn(this);
		setToolTipText("Press this Button to Logout of Application");
	}
	
	@Override
	public void execute() {
		logger.info("Application closed on demand");
		med.logout();
	}

}
